package com.econ.powercloud.ems.common.enums;

import com.google.common.collect.Lists;

import java.util.List;

/**
 * @Author : zjf
 * @Description : 场景服务中 特殊标签对应的值的枚举
 * 例如：单体电压，单体温度，单体电压最大值
 * @Date : 2022/5/23 15:32
 * @Modified by : zjf
 */
public enum SceneSpecialTagType {

    UH("Uh", "单体电压最大值",1),
    NUH("Nuh","单体ID",2),
    UL("Ul","单体电压最小值",3),
    NUL("Nul","单体ID",4),
    TH("Th","单体温度最大值",5),
    NTH("Nth","单体ID",6),
    TL("Tl","单体温度最小值",7),
    NTL("Ntl","单体ID",8),
    DTU("dtU","单体电压",9),
    DTT("dtT","测温点",10),
    ;

    private String code;
    private String desc;
    private int sorting;

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public int getSorting() {
        return sorting;
    }

    SceneSpecialTagType(String code, String desc, int sorting){
        this.code=code;
        this.desc=desc;
        this.sorting=sorting;
    }

    public static String getCodeFromCode(String code){
        for(SceneSpecialTagType type: SceneSpecialTagType.values()){
            if(code.equals(type.getCode())){
                return type.getDesc();
            }
        }
        return null;
    }

    /**
     * 获取BMU报表中用到的tag
     * @return
     */
    public static List<SceneSpecialTagType> getBMUReportTag(){
        List<SceneSpecialTagType> list = Lists.newArrayList();
        for(SceneSpecialTagType type: SceneSpecialTagType.values()){
            if(UH.sorting <= type.getSorting() && NTL.sorting >= type.getSorting() ){
                list.add(type);
            }
        }
        return list;
    }
}
